/* TODO  更改样式 */

.segment {
    position: absolute;
    height: 40px !important;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-width: 20px;
}

.segment:hover {
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.segment.selected {
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.segment.dragging {
    opacity: 0.8;
    z-index: 100;
    transition: none;
}

/* 片段内容 */
.segment-content {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 6px 8px;
    box-sizing: border-box;
    position: relative;
}

.segment-text {
    font-size: 13px;
    color: white;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.segment-duration {
    position: absolute;
    bottom: 3px;
    right: 4px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 3px;
    border-radius: 2px;
}

/* 缩略图 */
.segment-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
}

.text-content {
    justify-content: flex-start;
}

/* 图片片段样式 */
.image-segment {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.9), rgba(40, 167, 69, 0.7));
}

.image-content {
    padding: 3px;
}

.image-content .segment-thumbnail {
    border-radius: 2px;
}

/* 视频片段样式 */
.video-segment {
    background: linear-gradient(135deg, rgba(54, 46, 204, 0.9), rgba(54, 46, 204, 0.7));
}

.video-content {
    padding: 3px;
    position: relative;
}

.video-content .segment-thumbnail {
    border-radius: 2px;
}

/* 音频片段样式 */
.audio-segment {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.9), rgba(220, 53, 69, 0.7));
}

.audio-content {
    flex-direction: column;
    align-items: flex-start;
    padding: 6px 6px;
}

.audio-waveform {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    margin: 3px 0;
}

.waveform-bars {
    display: flex;
    align-items: end;
    height: 24px;
    width: 100%;
    gap: 1px;
}

.waveform-bar {
    background: rgba(255, 255, 255, 0.8);
    width: 2px;
    min-height: 2px;
    border-radius: 1px;
    transition: height 0.1s ease;
}

/* 调整大小手柄 */
.resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: transparent;
    cursor: ew-resize;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.resize-handle.left {
    left: 0;
}

.resize-handle.right {
    right: 0;
}

.segment:hover .resize-handle {
    opacity: 1;
    background: rgba(255, 255, 255, 0.6);
}

.segment.selected .resize-handle {
    opacity: 1;
    background: rgba(255, 255, 255, 0.8);
}

/* 预览区域 */
.segment-preview {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    min-width: 300px;
    max-width: 500px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.preview-content h4 {
    margin: 0 0 12px 0;
    color: white;
    font-size: 16px;
    font-weight: 600;
}

.preview-content p {
    margin: 6px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.preview-media {
    margin-top: 12px;
    text-align: center;
}

.preview-media img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
}

.preview-media video {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .segment {
        height: 40px;
    }
    
    .segment-text {
        font-size: 11px;
    }
    
    .segment-icon {
        font-size: 12px;
    }
    
    .segment-preview {
        min-width: 250px;
        max-width: 90vw;
    }
}

/* 动画效果 */
@keyframes segmentPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.segment.selected {
    animation: segmentPulse 2s ease-in-out infinite;
}

/* 深色主题适配 */
@media (prefers-color-scheme: dark) {
    .segment-preview {
        background: rgba(20, 20, 20, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
}